<?php

/**
 * common componets.
 *
 * @package    amarula
 * @subpackage home
 * @author     Fox Matuku
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class commonComponents extends sfComponents {

	public function executeHeaderSignedOut(sfWebRequest $request) {
		$headerLinks = sfYaml::load(dirname(__FILE__) . "/../config/menu_signed_out.yml");
		$this->__grabSomeLinks($headerLinks);
	}

	public function executeHeaderSignedIn(sfWebRequest $request) {
		$this->menu = sfYaml::load(dirname(__FILE__) . "/../config/menu_signed_in.yml");
        $this->itemParams = array(
            'slug' => $this->getUser()->getDpUser()->getSlug(),
            'notification_token' => $this->getUser()->getDpUser()->getNotificationToken()
        );
	}

	private function __grabSomeLinks($headerLinks = null) {
		$this->headerLinks = array();
		$currentAction = $this->getContext()->getActionName();

		foreach ($headerLinks as $route => $link) {
			$link["is_current"] = false;
			$this->headerLinks[$route] = $link;
		}
	}

	public function executeMyTabs(sfWebRequest $request) {
		$this->menu = sfYaml::load(dirname(__FILE__) . "/../config/menu_signed_in.yml");
        $this->itemParams = array(
            'slug' => $this->getUser()->getDpUser()->getSlug(),
            'notification_token' => $this->getUser()->getDpUser()->getNotificationToken()
        );
	}

	public function executeFooter(sfWebRequest $request) {
        $this->specialities = SpecialityTable::getInstance()->retrieveByIsActive();
        $this->cities = CityTable::getInstance()->retrieveByIsActive();
	}

	public function executeGa(sfWebRequest $request) {

	}

}